package com.example.demo.javatest.thread;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by liujiahao on 2019/3/12.
 */
public class Service {
    private boolean isRun=true;
    private AtomicInteger count;
     static class fservice{

    }
    public synchronized  static void funA(String name){
        //System.out.println("当前标志"+isRun);
       /* while (isRun){
            System.out.println("当前线程："+Thread.currentThread().getName());
            *//*synchronized (this){
                *//**//*System.out.println(Thread.currentThread().getName());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }*//**//*
            }*//*
        }*/
        System.out.println("当前线程："+Thread.currentThread().getName());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("当前线程："+Thread.currentThread().getName()+"结束");
    }
    public  void stop(){
        synchronized (Service.class){
            System.out.println("当前线程："+Thread.currentThread().getName());
            System.out.println("当前线程："+Thread.currentThread().getName()+"结束");
        }
        /*isRun=false;
        System.out.println("停止开始");*/
    }
}

